﻿using CRM.Infrastructure.Dto.Response.Reservation;
using CRM.Service.Instance;
using CRM.Service.Interface;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace CRM.Api.Admin.Controllers
{
    /// <summary>
    /// 预约
    /// </summary>
    public class ReservationController : BaseController
    {
        private readonly I_Reservation_Service _reservation_Service;
        public ReservationController(I_Reservation_Service reservation_Service, I_Login_Service login_Service) : base(login_Service)
        {
            _reservation_Service = reservation_Service;
        }
        /// <summary>
        /// 获取预约列表
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Reservation(int? page = 1, int? limit = 10, string? key = "")
        {
            var result = await _reservation_Service.Get_Reservation(page ?? 1, limit ?? 10, key ?? "");
            return Ok(result);
        }
        /// <summary>
        /// 添加预约
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> Add_Reservation(Reservation_Response_Dto dto)
        {
            var result = await _reservation_Service.Add_Reservation(dto);
            return Ok(result);
        }
    }
}
